//------------------------------------------------
//		IMU.h
//	IMU  library
//------------------------------------------------
//
//	Description:
//	Encapsulte routines for reading the MPU6050 and HMC5883 sensors
//
//-----------------------------------------------
//
//	Requeriments:
//	I2C library
//	HMC5883 on the I2C bus
//	MPU6050 on the I2C bus
//
//-----------------------------------------------
#include "MPU6050/MPU6050.h"
#include "HMC5883/HMC5883.h"

typedef struct {
    int X;
    int Y;
    int Z;
}vector;

typedef union {
    struct {
        MPUdata MPU;
        HMC5883data HMC;
    };
    struct{
        vector Accel;
        int Temp;
        vector Gyro;
        vector Mag;
    };
} IMUdata;

//---------------- Functions ---------------------
unsigned char initIMU(void);            // Initialize IMU sensors, return true if error
unsigned char readIMU(IMUdata *data);   // return true if error
